<html>
<head>
    <title>XBRLAPI unit test configuration suggestions</title>
    <link rel="stylesheet" href="/css/styles.css" type="text/css"/>
    <script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
        try {
            var pageTracker = _gat._getTracker("UA-11401995-1");
            pageTracker._setDomainName("none");
            pageTracker._setAllowLinker(true);
            pageTracker._trackPageview();
        } catch (err) {
        }</script>
</head>


<body>

<div class="logo_container">
	<span class="logo">
		<a class="title" href="/">XBRLAPI</a>
	</span>
	<span class="logo_subscript">
		<a class="title" href="http://en.wikipedia.org/wiki/Free_and_open_source_software">Free Open-Source Software</a>
	</span>
</div>

<div id="navcontainer">
    <form action="http://www.xbrlapi.org/search.html" id="cse-search-box">
        <div>
            <input type="hidden" name="cx" value="partner-pub-3957505011939955:jqid48zd81o"/>
            <input type="hidden" name="cof" value="FORID:10"/>
            <input type="hidden" name="ie" value="ISO-8859-1"/>
            <input type="text" name="q" size="31"/>
            <input type="submit" name="sa" value="Search"/>
        </div>
    </form>

    <script
            type="text/javascript"
            src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en">
    </script>

    <ul id="navlist">
        <li><a href="/">Home</a></li>
        <li><a href="testConfigurationFile.html">Configuration Properties</a></li>
    </ul>

    <script type="text/javascript"><!--
    google_ad_client = "pub-3957505011939955";
    /* XBRLAPI site */
    google_ad_slot = "4927123290";
    google_ad_width = 160;
    google_ad_height = 600;
    //-->
    </script>
    <script type="text/javascript"
            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

</div>

<div class="content">

    <h1>XBRLAPI Unit testing with TestNG</h1>

    <h2>Overview</h2>

    <p>With the 5.4 release, the XBRLAPI has migrated across to using TestNG for unit testing.</p>

    <p>A comprehensive test of your XBRLAPI installation is possible using the
        <a href="http://testng.org/doc/index.html">TestNG</a> tests that are distributed
        with XBRLAPI.</p>

    <h2>Install a local version of the XBRL 2.1 conformance suite</h2>

    <p>If you want to run the unit tests that are distributed with XBRLAPI,
        then it is necessary to configure the test data environment. A key part
        of this configuration involves installation of the XBRL 2.1 conformance
        suite.</p>

    <p>The conformance suite is available from <a href="http://www.xbrl.org/SpecRecommendations/">the
        list of XBRL specification recommendations</a>.</p>

    <p>Download the zip file and extract it to the desired location in your
        local environment. You can either serve up the files in the conformance
        suite directly from your local file system (using the file scheme URLs)
        or you can serve them via a local web server such as <a href="http://httpd.apache.org/">Apache</a> (using http
        scheme URLs).</p>

    <h2>Set up the test configuration file</h2>

    <p>It is necessary to set a range of test configuration properties to
        provide information regarding the setup of the underlying data stores
        and the available test data. This is done using a Java properties file
        whose location must be specified by a system property called <code>xbrlapi.test.configuration</code>.</p>

    <p>The test configuration file sets a large number of configuration
        properties. These are explained in the <a href="testConfigurationFile.html">test configuration documentation</a>.
    </p>

    <p>One way to specify the location of the properties file is to add
        <code>-Dxbrlapi.test.configuration=/path/to/configuration/file/filename</code> to the set of
        parameters used when running Java. In Eclipse, add this as a virtual machine argument for
        your project's java runtime environment. Naturally set <code>/path/to/configuration/file</code> to the
        path to the configuration file that you want to use and set <code>filename</code> to the name
        of your configuration file.</p>

    <p>
        You can grab a copy of an up-to-date properties file from the
        <a href="http://xbrlapi.svn.sourceforge.net/viewvc/xbrlapi/trunk/test.configuration.properties?view=log">SVN
            repository</a>.
        <em>Note that it will need to be customised to reflect your own directory structures.</em>
    </p>

    <h2>Execute the Unit Tests</h2>

    <p>Unit test execution can be done in a number of ways. These include:</p>

    <ul>
        <li>Unit testing using the Eclipse IDE</li>
        <li>Unit testing using Maven</li>
    </ul>

    <h2>Unit testing from within Eclipse</h2>

    <p>Install the <a href="http://testng.org/doc/eclipse.html">TestNG Eclipse plugin</a>.</p>

    <p>Select the set of test classes or methods that you want to
        execute, and then run them from the context menu in
        Eclipse.</p>

    <h2>Unit testing using Maven</h2>

    <p>From the directory containing the POM file for the module that you want to test, run, at the command line:</p>

    <pre>mvn test</pre>

    <p>
        <a href="http://sourceforge.net/projects/xbrlapi"><img
                src="http://sflogo.sourceforge.net/sflogo.php?group_id=135539&type=11" width="120" height="30"
                border="0"
                alt="Get Java XBRL API implementation at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a>
    </p>

</div>

</body>
</html>
